import React, {useRef} from 'react'
import { useTodo } from '../../context/todo-list'

const Input = () => {
    const inpRef = useRef();
    const {handleList} = useTodo();
    const handleAdd = () => {
        handleList(inpRef.current.value)
    }
    return (
        <div>
            <input ref={inpRef} type="text" />
            <button onClick={handleAdd}>添加</button>
        </div>
    )
}

export default Input